package it.uniroma2.art.coda.imdb;

public class TestCont {

	
	public static void main(String args[]) {
		long numero = 1000*1000*100;
		int arraySize = 20;
		int valueCompare = 1; // 0 or 1
		
		long[] arrayTime = new long[arraySize+1];
		
		//TestCont testCont = new TestCont();
		
		long start = System.currentTimeMillis();
		arrayTime[0] = start;
		int cont;
		for(int i=1; i<=arraySize; ++i){
			cont=0;
			while(cont<numero){
				if((i-1)%2==valueCompare)
					cont++;
				else
					++cont;
			}
			arrayTime[i] = System.currentTimeMillis();
		}
		
		long milliSec=0;
		for(int i=1; i<=arraySize; ++i){
			String text;
			milliSec = arrayTime[i]-arrayTime[i-1];
			if((i-1)%2==valueCompare)
				text = "cont++ = "+ milliSec;
			else
				text = "++cont = "+milliSec;
			if((i-1)%2==1)
				text+="\n";
			System.out.println(text);
			
		}
		
	}
	
	
	public String printPrettyTime(long start, long end){
		long secTotal = (end-start)/1000;
		long sec = secTotal % 60;
		long minTotal = secTotal / 60 ;
		long min = minTotal % 60 ;
		long hourTotal = minTotal / 60 ;
	
		String prettyTime = "";
		if(hourTotal<10)
			prettyTime += "0";
		prettyTime += hourTotal+":";
		if(min<10)
			prettyTime += "0";
		prettyTime += min+":";
		if(sec<10)
			prettyTime += "0";
		prettyTime += sec;
		
		return prettyTime;
	}
}
